#include <iostream>
#include <queue>
using namespace std;

int main(){
	int n,a,B,l;
	queue<int> q;
	cin>>n>>a>>B;
	int k[n][n],b[n]={0};
	for(int i=0;i<n;i++){
		cin>>l;
		for(int j=0;j<n;j++) k[i][j]=0;
		if(i-l >= 0) k[i][i-l] = 1;
		if(i+l < n) k[i][i+l] = 1;
	}
	if(a == B){
		cout<<0;
		return 0;
	}
	q.push(a-1);
	b[a-1] = 1;
	//bfs
	while(!q.empty()){
		int s = q.front();
		q.pop();
		
		for(int j=0; j<n; j++){
			if(k[s][j] && !b[j]){
				if(j == B-1){
					cout<<b[s];
					return 0;
				}
				b[j] = b[s]+1;
				q.push(j);
			}
		}				
	}
	cout<<-1;
	return 0;
}
